from tkinter import *
from tkinter.filedialog import askopenfilename
from tkinter.messagebox import showinfo
frameT = Tk()
frameT.geometry('500x200+400+200')
frameT.title('选择需要输入处理的文件')
frame = Frame(frameT)
frame.pack(padx=10, pady=10)  # 设置外边距
frame_1 = Frame(frameT)
frame_1.pack(padx=10, pady=10)  # 设置外边距
frame1 = Frame(frameT)
frame1.pack(padx=10, pady=10)
file1 = StringVar()
file2 = StringVar()
Entry(frame, width=50, textvariable=file1).pack(fill=X, side=LEFT)  # x方向填充,靠左
Entry(frame_1, width=50, textvariable=file2).pack(fill=X, side=LEFT)  # x方向填充,靠左


def fileopen():
    file_sql = askopenfilename()
    if file_sql:
        file1.set(file_sql)

def fileopen_1():
    file_YuD = askopenfilename()
    if file_YuD:
        file2.set(file_YuD)

def match():
    print(file1.get(), file2.get())
    pass

Button(frame, width=20, text='总文件', font=("宋体", 14), command=fileopen).pack(fil=X, padx=10)
Button(frame_1, width=20, text='匹配文件', font=("宋体", 14), command=fileopen_1).pack(fil=X, padx=10)
Button(frame1, width=10, text='运行', font=("宋体", 14), command=match).pack(fill=X, side=LEFT)
Button(frame1, width=10, text='退出', font=("宋体", 14), command=frameT.quit).pack(fill=Y, padx=10)
frameT.mainloop()

Host = format(frameT)
Host.pack(padx=10, pady=10)



def get_file():
    file = askopenfilename()
    if file:
        Host_file.set(file)

##设置用户名输入框
Host_file = StringVar()  # 设置用户名函数类型为字符串
# ##设置登录界面信息
Label_list = {'主机文件': 90, '测试次数': 140, '测试类型': 190}
for i in Label_list:
    text = i
    y = Label_list.get(i)
    Label(frameT, text="%s：   " % text, font=("宋体", 15)).place(x=60, y=y)  # x与y的数值为坐标轴


def browse():
    path = askopenfilename()
    return path
# 账号输入框默认信息
# ##设置用户名输入框
Input_box =StringVar()  # 设置用户名函数类型为字符串
Entry(frameT, textvariable=Host_file).place(x=160, y=90)
Entry(frameT, textvariable=Host_file).place(x=160, y=140)
Entry(frameT, textvariable=Host_file).place(x=160, y=190)




# 自定义注册指令函数的操作
def info():
    messagebox.shoframeTfo(title="温馨提示", message="你瞅啥")
def connect():
    pass
def disconnect():
    pass
def by():
    pass

##创建按钮
Bt_list = {'连接': {'connect': {'connect': {60: 300}}},
           '断开': {'disconnect': {'disconnect': {220: 300}}},
           '退出程序': {'exit': {'exit': {380: 300}}},
           '坐公交也用券': {'by': {'info': {60: 350}}}}
Button(frameT, text='浏览',  font=('宋体', 15), command=browse).place(x=400, y=80)

for text in Bt_list:
    status_list = Bt_list[text]
    for status in status_list:
        cmd_list = status_list[status]
        for cmd in cmd_list:
            x_list = cmd_list[cmd]
            for x in x_list:
                y = x_list[x]
                if status == 'connect':
                   Button(frameT, text=text, font=('宋体', 15), command=connect).place(x=x, y=y)
                elif status == 'disconnect':
                   Button(frameT, text=text, font=('宋体', 15), command=disconnect).place(x=x, y=y)
                elif status == 'exit':
                   Button(frameT, text=text, font=('宋体', 15), command=exit).place(x=x, y=y)
                elif status == 'by':
                   Button(frameT, text=text,  font=('宋体', 15), command=cmd).place(x=x, y=y)
# 进入消息循环
frameT.mainloop()